<?php
/**
 * 商品收藏模型
 * @author maniac
 */
namespace app\common\model;

class GoodsCollect extends Base
{

    
    protected $table = "maniac_goods_collect";
    protected $createTime = "created_at";
    protected $updateTime = "updated_at";
    protected $autoWriteTimestamp = "datetime";     // 自动写入时间戳
    
    /**
     * 商品信息获取器
     * @param string $value 字段值
     * @param array  $data  所有数据
     */
    public function getGoodsAttr($value, $data)
    {
        return Goods::field('id,goods_name,sale_price,goods_thumb_id')->append(['image_uri','total_sale_nums'])->where('id', $data['goods_id'])->find();
    }
}
